package homeword;

public class objectArray {
    private String productID;//商品对象
    private String name;
    private double price;
    private int stock;//库存
    public objectArray() {
    }

    public objectArray(String productID, String name, double price, int stock) {
        this.productID = productID;
        this.name = name;
        this.price = price;
        this.stock = stock;
    }

    /**
     * 获取
     * @return productID
     */
    public String getProductID() {
        return productID;
    }

    /**
     * 设置
     * @param productID
     */
    public void setProductID(String productID) {
        this.productID = productID;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return price
     */
    public double getPrice() {
        return price;
    }

    /**
     * 设置
     * @param price
     */
    public void setPrice(double price) {
        this.price = price;
    }

    /**
     * 获取
     * @return stock
     */
    public int getStock() {
        return stock;
    }

    /**
     * 设置
     * @param stock
     */
    public void setStock(int stock) {
        this.stock = stock;
    }

    public String toString() {
        return "objectArrayTest{productID = " + productID + ", name = " + name + ", price = " + price + ", stock = " + stock + "}";
    }

    public void showArr(objectArray []objectArrayTests){
        for (int i = 0; i < objectArrayTests.length; i++) {
            System.out.println("ID："+objectArrayTests[i].productID+"\n名字:"+objectArrayTests[i].name+"\n价格："+objectArrayTests[i].price+"\n库存:"+objectArrayTests[i].stock);
        }
    }
}
